import 'package:flutter_test/flutter_test.dart';
import 'package:flutter_restart_app/flutter_restart_app.dart';
import 'package:flutter_restart_app/flutter_restart_app_platform_interface.dart';
import 'package:flutter_restart_app/flutter_restart_app_method_channel.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';

class MockFlutterRestartAppPlatform
    with MockPlatformInterfaceMixin
    implements FlutterRestartAppPlatform {

  @override
  Future<String?> getPlatformVersion() => Future.value('42');

  @override
  Future<bool> restartApp() {
    // TODO: implement restartApp
    throw UnimplementedError();
  }
}

void main() {
  final FlutterRestartAppPlatform initialPlatform = FlutterRestartAppPlatform.instance;

  test('$MethodChannelFlutterRestartApp is the default instance', () {
    expect(initialPlatform, isInstanceOf<MethodChannelFlutterRestartApp>());
  });

  test('getPlatformVersion', () async {
    RestartApp flutterRestartAppPlugin = RestartApp();
    MockFlutterRestartAppPlatform fakePlatform = MockFlutterRestartAppPlatform();
    FlutterRestartAppPlatform.instance = fakePlatform;

    expect(await flutterRestartAppPlugin.getPlatformVersion(), '42');
  });
}
